﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;

namespace _1065093_1065130_1065120_DoAn
{
    public partial class frm_ThemKhachHang : Form
    {
        public frm_ThemKhachHang()
        {
            InitializeComponent();
        }

        private void frm_ThemKhachHang_Load(object sender, EventArgs e)
        {
            
        }

        private void btnthem_Click(object sender, EventArgs e)
        {
            KHACHHANGBUS BUS = new KHACHHANGBUS();
            int diemtichluy = 0;
            int max = 0;
            BUS.THEM_KHACHHANG(txthoten.Text, txtsdt.Text, diemtichluy);
            DataTable dt = new DataTable();
            dt = BUS.GET_KHACHHANG();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                if (int.Parse(dr["MaKH"].ToString().Trim()) > max)
                {
                    max = int.Parse(dr["MaKH"].ToString().Trim());
                }

            }
            MessageBox.Show("Thêm Thành Công_Mã Số Khách Hàng Là:" + max, "Thông Báo");
        }
    }
}
